
import request from '@/utils/request'

export const getEmployees = () => request.get('/sys/user/simple')
// 获取员工列表
export const logetEmployees = (params) => request.get('/sys/user', { params })
// 新增
export const postEmployees = (data) => request.post('/sys/user', data)
// 删除
export const delEmployees = (id) => request.delete(`/sys/user/${id}`)
// 批量添加
export const excelEmployees = (data) => request.post(`/sys/user/batch`, data)
// 修改
export const putEmployees = (data) => request.put(`/sys/user/${data.id}`, data)

// 打印员工信息
export function getJobDetail(id) {
  return request({
    url: `/employees/${id}/jobs`,
    method: 'get'
  })
}

// 根据ID获取角色详情
export const getRoles = (params) => request.get(`/sys/role`, { params })
// export function getRoles(params) {
//   return request({
//     url: '/sys/role',
//     method: 'GET',
//     params: params
//   })
// }

/**
 * @description: 为用户分配角色
 * @param {*} data { id:当前用户id, roleIds:选中的角色id组成的数组 }
 * @return {*}
 */
export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}

